<!DOCTYPE HTML>
<html lang="zh-CN">


<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="utf-8">
    <meta name="keywords" content="oracle向mysql改造, java,集群,分布式">
    <meta name="description" content="前言​        由于工作需要，把oracle数据库改造成mysql数据库，而oracle和mysql在一定程度上有很大的区别，我们的工作是在已有项目改bug，所以特地总结一下这几天项目需要的改动。


函数式报错start with ">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>oracle向mysql改造 | cxkの博客</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">
    
    <script src="/libs/jquery/jquery.min.js"></script>
    
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper head-container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">cxkの博客</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>

<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">cxkの博客</div>
        <div class="logo-desc">
            
            积跬步而至千里
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/blinkfox/hexo-theme-matery" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>

        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/blinkfox/hexo-theme-matery" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/14.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">oracle向mysql改造</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/原创/">
                                <span class="chip bg-color">原创</span>
                            </a>
                        
                            <a href="/tags/oracle/">
                                <span class="chip bg-color">oracle</span>
                            </a>
                        
                            <a href="/tags/mysql/">
                                <span class="chip bg-color">mysql</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/oracle/" class="post-category">
                                oracle
                            </a>
                        
                            <a href="/categories/oracle/mysql/" class="post-category">
                                mysql
                            </a>
                        
                            <a href="/categories/oracle/mysql/原创/" class="post-category">
                                原创
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-01-10
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-04-20
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    1.8k
                </div>
                

                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>

        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>​        由于工作需要，把oracle数据库改造成mysql数据库，而oracle和mysql在一定程度上有很大的区别，我们的工作是在已有项目改bug，所以特地总结一下这几天项目需要的改动。</p>
<a id="more"></a>

<h2 id="函数式报错"><a href="#函数式报错" class="headerlink" title="函数式报错"></a>函数式报错</h2><h3 id="start-with-connect-by-prior函数错误"><a href="#start-with-connect-by-prior函数错误" class="headerlink" title="start with connect by prior函数错误"></a>start with connect by prior函数错误</h3><h4 id="问题描述："><a href="#问题描述：" class="headerlink" title="问题描述："></a>问题描述：</h4><p>​        这个是oracle特有的一个函数，是根据条件递归查询”树”。注意递归查询，常用用法：start with connect by prior parentId=id或start with connect by prior id=parentId，第一种是：查询结果自己所有的后代节点（包括自己）；第二种用法是查询结果自己所有的父类节点（包括自己）。</p>
<h4 id="解决方案："><a href="#解决方案：" class="headerlink" title="解决方案："></a>解决方案：</h4><p>​        Mysql不支持通过start with connect by进行递归查询，所以创建函数进行查找。</p>
<p>​        首先是第一种：查询结果自己所有的后代节点（包括自己），首先得了解find_in_set这个函数作用，举个例子：find_in_set（parent_id,”1,2,3”）的意思是parent_id在1,2,3内。创建函数如下：</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">create</span> <span class="token keyword">function</span> getTaskObject    <span class="token comment" spellcheck="true">--getTaskObject 函数名称</span>
<span class="token punctuation">(</span>rootId <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">)</span>             <span class="token comment" spellcheck="true">--输入值类型        </span>
<span class="token keyword">returns</span> <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">1024</span><span class="token punctuation">)</span>            <span class="token comment" spellcheck="true">--返回值类型</span>
<span class="token keyword">as</span>
    <span class="token keyword">begin</span>
        <span class="token keyword">DECLARE</span> sTemp <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">1024</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment" spellcheck="true">--定义变量</span>
        <span class="token keyword">DECLARE</span> sTempChd <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">1024</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--定义变量</span>

        <span class="token keyword">SET</span> sTemp <span class="token operator">=</span> <span class="token string">''</span><span class="token punctuation">;</span>
        <span class="token comment" spellcheck="true">-- SET sTempChd = CAST(auth_id AS CHAR);</span>
        <span class="token keyword">SET</span> sTempChd <span class="token operator">=</span> auth_id<span class="token punctuation">;</span>

        <span class="token keyword">WHILE</span> sTempChd <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DO</span> <span class="token comment" spellcheck="true">--如果不空一直循环</span>
            <span class="token keyword">IF</span> sTemp <span class="token operator">=</span> <span class="token string">''</span> <span class="token keyword">THEN</span>
                <span class="token keyword">SET</span> sTemp <span class="token operator">=</span> sTempChd<span class="token punctuation">;</span>
            <span class="token keyword">ELSE</span>
                <span class="token keyword">SET</span> sTemp<span class="token operator">=</span> CONCAT<span class="token punctuation">(</span>sTemp<span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span>sTempChd<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
            <span class="token keyword">SELECT</span> GROUP_CONCAT<span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token keyword">INTO</span> sTempChd <span class="token keyword">FROM</span> SBP_AUTH_ROLE <span class="token keyword">WHERE</span> FIND_IN_SET<span class="token punctuation">(</span>parent_id<span class="token punctuation">,</span>sTempChd<span class="token punctuation">)</span><span class="token operator">></span><span class="token number">0</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--把所有的id拼接接起来</span>
        <span class="token keyword">END</span> <span class="token keyword">WHILE</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--结束循环</span>
        <span class="token keyword">RETURN</span> sTemp<span class="token punctuation">;</span> <span class="token comment" spellcheck="true">--返回结果</span>
<span class="token keyword">end</span></code></pre>
<p>​        调用可以向平时调用内置函数一样调用，这个函数的返回值是所有符合条件id拼接起来字符串，所以我们调用也得加find_in_set(id,getTaskObject(值))</p>
<p>​         第二种：查询结果自己所有的父类节点，返回值也是所有符合条件id拼接起来字符串，所以我们调用也得加find_in_set(id,getTaskObject(子节点id))</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">create</span> <span class="token keyword">function</span> getTaskObject    <span class="token comment" spellcheck="true">--getTaskObject 函数名称</span>
<span class="token punctuation">(</span>rootId <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">)</span>             <span class="token comment" spellcheck="true">--输入值类型        </span>
<span class="token keyword">returns</span> <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">1024</span><span class="token punctuation">)</span>            <span class="token comment" spellcheck="true">--返回值类型</span>
<span class="token keyword">as</span>
    <span class="token keyword">BEGIN</span> 
        <span class="token keyword">DECLARE</span> sTemp <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">--定义变量</span>
        <span class="token keyword">DECLARE</span> sTempChd <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--定义变量</span>
        <span class="token keyword">DECLARE</span> allData <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">1024</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--定义变量</span>
        <span class="token keyword">SET</span> allData<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">;</span>                
        <span class="token keyword">SET</span> sTempChd <span class="token operator">=</span>cast<span class="token punctuation">(</span>rootId <span class="token keyword">as</span> CHAR<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">SET</span> sTemp<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">;</span>
        <span class="token keyword">WHILE</span> sTempChd <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DO</span> <span class="token comment" spellcheck="true">--如果不空一直循环</span>
                <span class="token keyword">SET</span> sTemp<span class="token operator">=</span>sTempChd<span class="token punctuation">;</span>
                <span class="token keyword">SET</span> allData<span class="token operator">=</span>CONCAT<span class="token punctuation">(</span>allData<span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span>sTempChd<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">SELECT</span> PARENT_ID <span class="token keyword">INTO</span> sTempChd <span class="token keyword">FROM</span> usbp_task_object <span class="token keyword">where</span> OBJECT_ID<span class="token operator">=</span>sTemp<span class="token punctuation">;</span>
        <span class="token keyword">END</span> <span class="token keyword">WHILE</span><span class="token punctuation">;</span>  <span class="token comment" spellcheck="true">--结束循环</span>
        <span class="token keyword">RETURN</span> allData<span class="token punctuation">;</span>     <span class="token comment" spellcheck="true">--返回结果</span>
    <span class="token keyword">END</span></code></pre>
<h4 id="延伸："><a href="#延伸：" class="headerlink" title="延伸："></a>延伸：</h4><h5 id="传入的table为动态table表怎么办？"><a href="#传入的table为动态table表怎么办？" class="headerlink" title="传入的table为动态table表怎么办？"></a>传入的table为动态table表怎么办？</h5><p>​        本以为这样写就可以全部用上，但这个有个明显的不足就是table只能写死，一开始的想法是把table传进去，但报错了，我是这样写的：</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">Select</span> parent_id <span class="token keyword">into</span> sTempChd <span class="token keyword">from</span> tableName<span class="token punctuation">(</span>ps：这是个变量<span class="token punctuation">)</span> <span class="token keyword">where</span> object_id<span class="token operator">=</span>sTemp<span class="token punctuation">;</span></code></pre>
<p>​        会报tableName这个表不存在的错误，因为sql不会自动识别tableName这个变量，它会认为有这个tableName的表 。</p>
<p>​         网上查找了资料说可以用动态sql，但函数不支持动态sql，所以解决办法就是写一个存储过程，以下讲解的是第二种查询结果自己所有的父类节点，如下:</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">PROCEDURE</span> SELECT_TREE<span class="token punctuation">(</span><span class="token operator">IN</span> keyColumn <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32</span><span class="token punctuation">)</span> <span class="token keyword">CHARSET</span> utf8<span class="token punctuation">,</span><span class="token operator">IN</span> tableName <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32</span><span class="token punctuation">)</span> <span class="token keyword">CHARSET</span> utf8<span class="token punctuation">,</span><span class="token operator">IN</span> parentColumn <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">32</span><span class="token punctuation">)</span> <span class="token keyword">CHARSET</span> utf8<span class="token punctuation">,</span>
<span class="token operator">IN</span> keyValue <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">64</span><span class="token punctuation">)</span> <span class="token keyword">CHARSET</span> utf8<span class="token punctuation">,</span><span class="token keyword">OUT</span> returndata <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">2048</span><span class="token punctuation">)</span> <span class="token keyword">CHARSET</span> utf8<span class="token punctuation">)</span><span class="token comment" spellcheck="true">--输入输出参数，in为输入，out为输出</span>
    <span class="token keyword">BEGIN</span>
            <span class="token keyword">declare</span> sTemp <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">--定义变量</span>
            <span class="token keyword">SET</span> sTemp <span class="token operator">=</span> keyValue<span class="token punctuation">;</span>
            <span class="token keyword">SET</span> returndata<span class="token operator">=</span><span class="token string">''</span><span class="token punctuation">;</span>

            <span class="token keyword">WHILE</span> sTemp <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">DO</span><span class="token comment" spellcheck="true">--如果不空一直循环</span>
                    <span class="token comment" spellcheck="true">-- 创建sql</span>
                    <span class="token keyword">SET</span> <span class="token variable">@selectSql</span> <span class="token operator">=</span> CONCAT<span class="token punctuation">(</span><span class="token string">'select '</span><span class="token punctuation">,</span>parentColumn<span class="token punctuation">,</span><span class="token string">' INTO @recordcount  from '</span><span class="token punctuation">,</span>tableName<span class="token punctuation">,</span><span class="token string">' where '</span><span class="token punctuation">,</span>keyColumn<span class="token punctuation">,</span><span class="token string">"='"</span><span class="token punctuation">,</span>sTemp<span class="token punctuation">,</span><span class="token string">"'"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token comment" spellcheck="true">-- 执行动态生成的sql语句</span>
                    PREPARE <span class="token keyword">temp</span> <span class="token keyword">FROM</span> <span class="token variable">@selectSql</span><span class="token punctuation">;</span>
                    <span class="token keyword">EXECUTE</span> <span class="token keyword">temp</span><span class="token punctuation">;</span>
                    <span class="token keyword">SET</span> sTemp <span class="token operator">=</span> <span class="token variable">@recordcount</span><span class="token punctuation">;</span><span class="token comment" spellcheck="true">--其实对比上面仔细看可以看出只是这一步不同</span>
                    <span class="token keyword">IF</span> sTemp <span class="token operator">IS</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">THEN</span>
                    <span class="token keyword">SET</span> returndata<span class="token operator">=</span>CONCAT<span class="token punctuation">(</span>returndata<span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span>sTemp<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token keyword">END</span> <span class="token keyword">IF</span><span class="token punctuation">;</span>
            <span class="token keyword">END</span> <span class="token keyword">WHILE</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">--结束循环</span>
    <span class="token keyword">END</span></code></pre>
<p>​        可以对比上面的自定义函数，一个注意地方是@recordcount 代替sTempChd 变量，声明这是个变量，其他是语法问题，逻辑和自定义函数相同。</p>
<p>​         然后就是调用测试，我是在Navicat测试的，我的版本可以直接传参（听说低版本不可以直接测试）。注意的是out输出参数要传递变量，如:(keycolum,tableName,pid,in,@returnData)。</p>
<p>​         <img src="/2020/01/10/oracle-xiang-mysql-gai-zao/%E6%B5%8B%E8%AF%95%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B.png" alt="测试存储过程"></p>
<p>​         以上是在Navicat调用的，在项目中，我们需要写sql调用，用的是mybatis框架，调用如下，最重要是要加上statementType=”CALLABLE”，如果传入是map，returnData这个名字可以随便取，传入是pojo，这个值必须固定，在pojo里面应该有个同名变量。返回值去传入的参数里拿，这个我传入的是map，所以直接去传入的map拿了，至于传入pojo要给个变量returnData，会自动注入。</p>
<p>​         </p>
<pre class=" language-xml"><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>mapper</span> <span class="token attr-name">namespace</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>com.shd.biz.Tree.service.impl.TreeServiceImpl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
    <span class="token comment" spellcheck="true">&lt;!-- 注意 statementType="CALLABLE" --></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>select</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>treeParent<span class="token punctuation">"</span></span> <span class="token attr-name">statementType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>CALLABLE<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
        {call SELECT_TREE(
        #{keyColumn,mode=IN},#{tableName,mode=IN},#{parentColumn,mode=IN},#{keyValue,mode=IN}
        ,#{returnData,mode=OUT,jdbcType=VARCHAR})}
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>select</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>mapper</span><span class="token punctuation">></span></span></code></pre>
<p>​      </p>
<pre class=" language-java"><code class="language-java">Map<span class="token operator">&lt;</span>String<span class="token punctuation">,</span> Object<span class="token operator">></span> parameters<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">HashMap</span><span class="token operator">&lt;</span>String<span class="token punctuation">,</span> Object<span class="token operator">></span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        parameters<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">"keyValue"</span><span class="token punctuation">,</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
        parameters<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">"tableName"</span><span class="token punctuation">,</span> table<span class="token punctuation">)</span><span class="token punctuation">;</span>
        parameters<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">"keyColumn"</span><span class="token punctuation">,</span> keyColumn<span class="token punctuation">)</span><span class="token punctuation">;</span>
        parameters<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">"parentColumn"</span><span class="token punctuation">,</span> parentColumn<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getDao</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">queryForDataSet</span><span class="token punctuation">(</span>SQL_PRIFIX <span class="token operator">+</span> <span class="token string">"treeParent"</span><span class="token punctuation">,</span> parameters<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment" spellcheck="true">//结果是从传入参数里面拿，不是从返回结果拿</span>
        String returnData <span class="token operator">=</span> parameters<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">"returnData"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
<h5 id="调用报方法read-Only错误"><a href="#调用报方法read-Only错误" class="headerlink" title="调用报方法read-Only错误"></a>调用报方法read-Only错误</h5><p>​         最后还有个报错是事务报错，是因为我项目get开头的方法设置了readOnly=”true”，而调用存储过程如果还设置readOnly属性就会报错，要加上@Transactional(readOnly = false)或改变service方法名。</p>
<h3 id="Sysdate报错"><a href="#Sysdate报错" class="headerlink" title="Sysdate报错"></a>Sysdate报错</h3><p>​        解决Sysdate替换为sysdate()</p>
<h3 id="to-char报错"><a href="#to-char报错" class="headerlink" title="to_char报错"></a>to_char报错</h3><p>​        网上查找的资料：</p>
<p>​       date_format(date,’%Y-%m-%d’) ————–&gt;oracle中的to_char();</p>
<p>​        str_to_date(date,’%Y-%m-%d’) ————–&gt;oracle中的to_date();</p>
<p>​       </p>
<h3 id="日期的计算"><a href="#日期的计算" class="headerlink" title="日期的计算"></a>日期的计算</h3><p>​        oracle 可以直接用sysdate加减乘除，而mysql不可以，如</p>
<p>近一个月：</p>
<p>​        Oracle——–&gt;sysdate-29</p>
<p>​        Mysql———&gt;</p>
<pre class=" language-sql"><code class="language-sql"><span class="token operator">&lt;</span><span class="token keyword">if</span> test<span class="token operator">=</span><span class="token string">"REPORT_TIME == '本周'"</span><span class="token operator">></span>
                <span class="token operator">and</span> YEARWEEK<span class="token punctuation">(</span>date_format<span class="token punctuation">(</span>report_time<span class="token punctuation">,</span><span class="token string">'%Y-%m-%d'</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">=</span> YEARWEEK<span class="token punctuation">(</span><span class="token function">now</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> 
            <span class="token operator">&lt;</span><span class="token operator">/</span><span class="token keyword">if</span><span class="token operator">></span>
            <span class="token operator">&lt;</span><span class="token keyword">if</span> test<span class="token operator">=</span><span class="token string">"REPORT_TIME == '本月'"</span><span class="token operator">></span>
                <span class="token operator">and</span> report_time <span class="token operator">>=</span>DATE_ADD<span class="token punctuation">(</span>curdate<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>interval <span class="token operator">-</span>day<span class="token punctuation">(</span>curdate<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token number">1</span> day<span class="token punctuation">)</span> <span class="token operator">and</span> report_time <span class="token operator">&amp;</span>lt<span class="token punctuation">;</span><span class="token operator">=</span> last_day<span class="token punctuation">(</span>SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span><span class="token keyword">if</span><span class="token operator">></span>
            <span class="token operator">&lt;</span><span class="token keyword">if</span> test<span class="token operator">=</span><span class="token string">"REPORT_TIME == '近1个月'"</span><span class="token operator">></span>
                <span class="token operator">and</span> report_time <span class="token operator">BETWEEN</span> date_sub<span class="token punctuation">(</span>SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>interval <span class="token number">1</span> month<span class="token punctuation">)</span> <span class="token operator">AND</span> SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span><span class="token keyword">if</span><span class="token operator">></span>
            <span class="token operator">&lt;</span><span class="token keyword">if</span> test<span class="token operator">=</span><span class="token string">"REPORT_TIME == '近3个月'"</span><span class="token operator">></span>
                <span class="token operator">and</span> report_time <span class="token operator">BETWEEN</span> date_sub<span class="token punctuation">(</span>SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>interval <span class="token number">3</span> month<span class="token punctuation">)</span> <span class="token operator">AND</span> SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span><span class="token keyword">if</span><span class="token operator">></span>
            <span class="token operator">&lt;</span><span class="token keyword">if</span> test<span class="token operator">=</span><span class="token string">"REPORT_TIME == '近1年'"</span><span class="token operator">></span>
                <span class="token operator">and</span> report_time <span class="token operator">BETWEEN</span> date_sub<span class="token punctuation">(</span>SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>interval <span class="token number">12</span> month<span class="token punctuation">)</span> <span class="token operator">AND</span> SYSDATE<span class="token punctuation">(</span><span class="token punctuation">)</span>
            <span class="token operator">&lt;</span><span class="token operator">/</span><span class="token keyword">if</span><span class="token operator">></span></code></pre>
<h3 id="Rownum报错"><a href="#Rownum报错" class="headerlink" title="Rownum报错"></a>Rownum报错</h3><p>​        在mysql中没有Rownum，所以要特殊的实现方法，实现和效果如下，但我项目是用来分页，所以直接就用limit。</p>
<p>​         </p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token variable">@rownum</span>:<span class="token operator">=</span><span class="token variable">@rownum</span><span class="token operator">+</span><span class="token number">1</span> <span class="token keyword">AS</span> rownum<span class="token punctuation">,</span> <span class="token keyword">table</span> <span class="token punctuation">.</span><span class="token operator">*</span>
<span class="token keyword">FROM</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token variable">@rownum</span>:<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">)</span> r<span class="token punctuation">,</span> <span class="token keyword">table</span> <span class="token punctuation">;</span></code></pre>
<h3 id="运算符报错"><a href="#运算符报错" class="headerlink" title="||运算符报错"></a>||运算符报错</h3><p>​        Mysql中||表示或的意识，而Oracle中||运算符可以将两个或两个以上的字符串连接在一起，在mysql中用concat代替。</p>
<h2 id="其他报错"><a href="#其他报错" class="headerlink" title="其他报错"></a>其他报错</h2><h3 id="表别名报错"><a href="#表别名报错" class="headerlink" title="表别名报错"></a>表别名报错</h3><p> 别名报错，首先mysql不可以像Oracle一样直接多重查找不加别名，如：</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">Select</span> <span class="token keyword">key</span> <span class="token keyword">from</span><span class="token punctuation">(</span><span class="token keyword">select</span> <span class="token keyword">key</span> <span class="token keyword">from</span> <span class="token keyword">database</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

改为<span class="token keyword">Select</span> t<span class="token punctuation">.</span><span class="token keyword">key</span> <span class="token keyword">from</span><span class="token punctuation">(</span><span class="token keyword">select</span> <span class="token keyword">key</span> <span class="token keyword">from</span> <span class="token keyword">database</span><span class="token punctuation">)</span> t<span class="token punctuation">;</span></code></pre>
<p>但在删除时又不可以加别名，如 ：</p>
<pre class=" language-sql"><code class="language-sql"><span class="token keyword">Delete</span> <span class="token keyword">from</span> <span class="token keyword">database</span> r <span class="token keyword">where</span> r<span class="token punctuation">.</span>id<span class="token operator">=</span>?会报错，得改为:

<span class="token keyword">Delete</span> <span class="token keyword">from</span> <span class="token keyword">database</span> <span class="token keyword">where</span> id<span class="token operator">=</span>?</code></pre>
<h3 id="Mysql没有序列问题"><a href="#Mysql没有序列问题" class="headerlink" title="Mysql没有序列问题"></a>Mysql没有序列问题</h3><h3 id="存储类型bigInteger装换toBigDecimal"><a href="#存储类型bigInteger装换toBigDecimal" class="headerlink" title="存储类型bigInteger装换toBigDecimal"></a>存储类型bigInteger装换toBigDecimal</h3><p>​             原来oracle存储数据类型是integer，现在存储类型为decimal，启动时报错，bigInteger cannot to cast toBigDecimal，所以，就得装换一下。</p>
<p><a href="https://www.cnblogs.com/diandianquanquan/p/10852620.html" target="_blank" rel="noopener">这是详情</a></p>
<h3 id="union报错"><a href="#union报错" class="headerlink" title="union报错"></a>union报错</h3><p>​        Oracle的union和mysql的union的一个细节错误导致，oracle可以用括号括起来，而mysql不可以</p>
<script>
        document.querySelectorAll('.github-emoji')
          .forEach(el => {
            if (!el.dataset.src) { return; }
            const img = document.createElement('img');
            img.style = 'display:none !important;';
            img.src = el.dataset.src;
            img.addEventListener('error', () => {
              img.remove();
              el.style.color = 'inherit';
              el.style.backgroundImage = 'none';
              el.style.background = 'none';
            });
            img.addEventListener('load', () => {
              img.remove();
            });
            document.body.appendChild(img);
          });
      </script>
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://xkunchen.github.io" rel="external nofollow noreferrer">XuKun Chen</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://xkunchen.github.io/2020/01/10/oracle-xiang-mysql-gai-zao/">https://xkunchen.github.io/2020/01/10/oracle-xiang-mysql-gai-zao/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="https://xkunchen.github.io" target="_blank">XuKun Chen</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/原创/">
                                    <span class="chip bg-color">原创</span>
                                </a>
                            
                                <a href="/tags/oracle/">
                                    <span class="chip bg-color">oracle</span>
                                </a>
                            
                                <a href="/tags/mysql/">
                                    <span class="chip bg-color">mysql</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">

<div id="article-share">
    
    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>
            
        </div>
    </div>

    
        <link rel="stylesheet" href="/libs/gitalk/gitalk.css">
<link rel="stylesheet" href="/css/my-gitalk.css">

<div class="card gitalk-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="gitalk-container" class="card-content"></div>
</div>

<script src="/libs/gitalk/gitalk.min.js"></script>
<script>
    let gitalk = new Gitalk({
        clientID: '',
        clientSecret: '',
        repo: '',
        owner: '',
        admin: null,
        id: '2020-01-10T11-44-53',
        distractionFreeMode: false  // Facebook-like distraction free mode
    });

    gitalk.render('gitalk-container');
</script>
    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/03/16/http-xiang-jie/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/21.jpg" class="responsive-img" alt="HTTP详解">
                        
                        <span class="card-title">HTTP详解</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            面试官，别问我 HTTP 了！看这 30 张图就行！PS:以下文章来源于公众号小林coding ，作者小林coding，本人觉得不错就先收藏起来。
前言在面试过程中，HTTP 被提问的概率还是比较高的。
这里搜集了 5 大类 HTTP 面试
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-03-16
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/oracle/" class="post-category">
                                    oracle
                                </a>
                            
                            <a href="/categories/oracle/别人的优秀博客文章/" class="post-category">
                                    别人的优秀博客文章
                                </a>
                            
                            <a href="/categories/oracle/别人的优秀博客文章/转载/" class="post-category">
                                    转载
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/http/">
                        <span class="chip bg-color">http</span>
                    </a>
                    
                    <a href="/tags/别人的优秀博客文章/">
                        <span class="chip bg-color">别人的优秀博客文章</span>
                    </a>
                    
                    <a href="/tags/转载/">
                        <span class="chip bg-color">转载</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                本篇&nbsp;<i class="far fa-dot-circle"></i>
            </div>
            <div class="card">
                <a href="/2020/01/10/oracle-xiang-mysql-gai-zao/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/14.jpg" class="responsive-img" alt="oracle向mysql改造">
                        
                        <span class="card-title">oracle向mysql改造</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            前言​        由于工作需要，把oracle数据库改造成mysql数据库，而oracle和mysql在一定程度上有很大的区别，我们的工作是在已有项目改bug，所以特地总结一下这几天项目需要的改动。


函数式报错start with 
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-01-10
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/oracle/" class="post-category">
                                    oracle
                                </a>
                            
                            <a href="/categories/oracle/mysql/" class="post-category">
                                    mysql
                                </a>
                            
                            <a href="/categories/oracle/mysql/原创/" class="post-category">
                                    原创
                                </a>
                            
                            
                        </span>
                    </div>
                </div>

                
                <div class="card-action article-tags">
                    
                    <a href="/tags/原创/">
                        <span class="chip bg-color">原创</span>
                    </a>
                    
                    <a href="/tags/oracle/">
                        <span class="chip bg-color">oracle</span>
                    </a>
                    
                    <a href="/tags/mysql/">
                        <span class="chip bg-color">mysql</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>



    <footer class="page-footer bg-color">
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2019</span>
            <a href="https://xkunchen.github.io" target="_blank">XuKun Chen</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                class="white-color">11k</span>&nbsp;字
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/blinkfox" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1181062873@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1181062873" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1181062873" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/" + "search.xml", 'searchInput', 'searchResult');
});
</script>
    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->


    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    
    
    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"display":{"position":"right","hOffset":80,"vOffset":0,"opacity":0.8},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>

</html>
